package com.h3c.nem.client;

import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "sap", url = "${pm.sap.url}")
public interface SapClient {

    @PostMapping(value = "/api/ExCommon/GetAppToken", consumes = {"application/json"}, headers = {"Authorization={Authorization}"})
    JSONObject getToken(@RequestBody String str);

    @PostMapping(value = "/api/ExCommon/GetZfmEhrGetZhrtxzkdFromSapToHRSSC", consumes = {"application/json"}, headers = {"API-TOKEN={API-TOKEN}"})
    JSONObject getJobSalaryInfo(@RequestBody String str, @RequestParam("API-TOKEN") String token);



    @PostMapping(value = "/api/ExCommon/GetZfmEhrGetTstxFromSapToHRSSC", consumes = {"application/json"}, headers = {"API-TOKEN={API-TOKEN}"})
    JSONObject getWorekrInfoAbroad(@RequestBody String str, @RequestParam("API-TOKEN") String token);

    @PostMapping(value = "/api/ExCommon/GetZfmEhrTstxDlFromSapToHRSSC", consumes = {"application/json"}, headers = {"API-TOKEN={API-TOKEN}"})
    JSONObject getWorekrInfo(@RequestBody String str, @RequestParam("API-TOKEN") String token);

    /**
     * HC_NO ConfirmEntryDate ConfirmHRBP
     * @param str
     * @param token
     * @return {
     *     "data": null,
     *     "success": true,
     *     "message": "受理成功",
     *     "code": 1, 1-成功 2-失败
     *     "expiryDate": null
     * }
     */
    @PostMapping(value = "/api/ExCommon/ConfirmEntryDate", consumes = {"application/json"}, headers = {"API-TOKEN={API-TOKEN}"})
    JSONObject ConfirmEntryDate(@RequestBody String str, @RequestParam("API-TOKEN") String token);

    @GetMapping(value = "/api/ExCommon/GetAppSecret", consumes = {"application/json"})
    JSONObject getAppSecret(@RequestParam("appId")String appId, @RequestParam("curSecret") String curSecret);

    /**
     * 获取预备员工工号与新员工工号关联
     * @param workerIds 新员工工号
     *       {
     *          "EmpCode":["00021273","00020521"]
     *       }
     * @param token token
     * @return
     * {
     *     "data": [
     *         {
     *             "EmpCode": "00020521",
     *             "HC_NO": "90000180"
     *         },
     *         {
     *             "EmpCode": "00021273",
     *             "HC_NO": "90000180"
     *         }
     *     ],
     *     "success": true,
     *     "message": "获取成功",
     *     "code": 1,
     *     "expiryDate": null
     * }

     */
    @PostMapping(value = "/api/ExCommon/EmpCodeMaps", consumes = {"application/json"}, headers = {"API-TOKEN={API-TOKEN}"})
    JSONObject empCodeMaps(@RequestBody String workerIds,  @RequestParam("API-TOKEN") String token);

    /**
     * 实时获取新入职员工数据 半小时一次
     * @param body startDate开始日期 endDate结束日期
     * @param token token
     * @return
     */
    @PostMapping(value = "/api/ExCommon/EmpInfoOntime", consumes = {"application/json"}, headers = {"API-TOKEN={API-TOKEN}"})
    JSONObject empInfoOntime(@RequestBody String body,  @RequestParam("API-TOKEN") String token);

    /**
     * 新增/编辑人事范围配置
     * @param str
     * @param token
     * @return
     */
    @PostMapping(value = "/api/ExCommon/SaveCompanyRegistrationAddress", consumes = {"application/json"}, headers = {"API-TOKEN={API-TOKEN}"})
    String saveCompanyRegistrationAddress(@RequestBody String str, @RequestParam("API-TOKEN") String token);

    /**
     * 删除人事范围
     * @param str
     * @param token
     * @return
     */
    @PostMapping(value = "/api/ExCommon/DeleteCompanyRegistrationAddress", consumes = {"application/json"}, headers = {"API-TOKEN={API-TOKEN}"})
    String deleteCompanyRegistrationAddress(@RequestBody String str,  @RequestParam("API-TOKEN") String token);

    /**
     * 同步员工手机号
     * @param strList
     * @param token
     * @return
     */
    @PostMapping(value = "/api/ExCommon/InsertEmpTel", consumes = {"application/json"}, headers = {"API-TOKEN={API-TOKEN}"})
    String insertEmpTel(@RequestBody List<JSONObject> strList, @RequestParam("API-TOKEN") String token);

}
